package com.zkthink.ceres.order.entity;


import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zkthink.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;

/**
 * <p>
 * 购买者从购物中获得的利润(折扣和贡献值)
 * </p>
 *
 * @author kellen
 * @since 2020-08-22
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_member_profit_order")
@ApiModel(value = "Sales", description = "购买者从购物中获得的利润(折扣和贡献值)")
@AllArgsConstructor
public class MemberProfitOrder extends Entity<Long> {
    private static final long serialVersionUID = 1L;


    /**
     * 客户id
     */
    @ApiModelProperty(value = "客户id")
    @NotNull(message = "客户id不能为空")
    @TableField("mid")
    @Excel(name = "客户id")
    private Long mid;

    /**
     * 产品id
     */
    @ApiModelProperty(value = "产品id")
    @TableField("product_id")
    @Excel(name = "产品id")
    private Long productId;

    /**
     * 客户购买商品得到的贡献值
     */
    @ApiModelProperty(value = "客户购买商品得到的贡献值")
    @TableField("mid_contribution")
    @Excel(name = "客户购买商品得到的贡献值")
    private Long midContribution = 0L;

    /**
     * 客户购买商品得到的折扣
     */
    @ApiModelProperty(value = "客户购买商品得到的折扣")
    @TableField("mid_discount")
    @Excel(name = "客户购买商品得到的折扣")
    private Long midDiscount = 0L;

    /**
     * 客户直接推荐人id
     */
    @ApiModelProperty(value = "客户直接推荐人id")
    @TableField("frist_recommend")
    @Excel(name = "客户直接推荐人id")
    private Long fristRecommend;

    /**
     * 客户直接推荐人得到的贡献值
     */
    @ApiModelProperty(value = "客户直接推荐人得到的贡献值")
    @TableField("frist_contribution")
    @Excel(name = "客户直接推荐人得到的贡献值")
    private Long fristContribution = 0L;

    /**
     * 客户购买商品得到的折扣
     */
    @ApiModelProperty(value = "客户直接推荐人得到的折扣")
    @TableField("frist_discount")
    @Excel(name = "客户直接推荐人得到的折扣")
    private Long fristDiscount = 0L;

    /**
     * 客户间接推荐人id
     */
    @ApiModelProperty(value = "客户间接推荐人id")
    @TableField("second_recommend")
    @Excel(name = "客户间接推荐人id")
    private Long secondRecommend;

    /**
     * 客户间接推荐人得到的贡献值
     */
    @ApiModelProperty(value = "客户间接推荐人得到的贡献值")
    @TableField("second_contribution")
    @Excel(name = "客户间接推荐人得到的贡献值")
    private Long secondContribution = 0L;

    /**
     * 客户间接推荐人得到的折扣
     */
    @ApiModelProperty(value = "客户间接推荐人得到的折扣")
    @TableField("second_discount")
    @Excel(name = "客户间接推荐人得到的折扣")
    private Long secondDiscount = 0L;

    /**
     * 平台现金
     */
    @ApiModelProperty(value = "平台现金")
    @TableField("plateform_cash")
    @Excel(name = "平台现金")
    private Long plateformCash = 0L;

    /**
     * 订单号
     */
    @ApiModelProperty(value = "订单号")
    @NotEmpty(message = "订单号不能为空")
    @Length(max = 16, message = "订单号长度不能超过16")
    @TableField(value = "order_no", condition = LIKE)
    @Excel(name = "订单号")
    private Long orderNo;
    /**
     * 商户编号
     */
    @ApiModelProperty(value = "商户编号")
    @NotEmpty(message = "商户编号不能为空")
    @TableField(value = "tenant_code", condition = LIKE)
    @Excel(name = "商户编号")
    private String tenantCode;


    /**
     * 结算状态 1未结算 2已结算
     */
    @ApiModelProperty(value = "结算状态 1未结算 2已结算")
    @NotNull(message = "结算状态 1未结算 2已结算不能为空")
    @TableField("settle_status")
    @Excel(name = "结算状态 1未结算 2已结算")
    private Integer settleStatus;
    /**
     * 订单实付金额
     */
    @ApiModelProperty(value = "订单实付金额")
    @NotNull(message = "订单实付金额不能为空")
    @TableField("order_amount")
    @Excel(name = "订单实付金额")
    private Long orderAmount;

    /**
     * 逻辑删除 1-删除 0-未删除
     */
    @ApiModelProperty(value = "逻辑删除 1-删除 0-未删除")
    @NotNull(message = "逻辑删除 1-删除 0-未删除不能为空")
    @TableField("is_delete")
    @Excel(name = "逻辑删除 1-删除 0-未删除")
    @TableLogic
    private Integer isDelete;

    @Builder
    public MemberProfitOrder(Long id, LocalDateTime updateTime, Long updateUser, LocalDateTime createTime, Long createUser, Integer isDelete,
                             Integer settleStatus, Long orderAmount, Long orderNo, String tenantCode,
                             Long mid, Long midContribution, Long midDiscount,
                             Long fristRecommend, Long fristContribution, Long fristDiscount, Long plateformCash,
                             Long secondRecommend, Long secondContribution, Long secondDiscount, Long productId) {
        this.id = id;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.createTime = createTime;
        this.createUser = createUser;
        this.isDelete = isDelete;
        this.orderAmount = orderAmount;
        this.settleStatus = settleStatus;
        this.orderNo = orderNo;
        this.tenantCode = tenantCode;
        this.mid = mid;
        this.midContribution = midContribution;
        this.midDiscount = midDiscount;
        this.fristRecommend = fristRecommend;
        this.fristContribution = fristContribution;
        this.fristDiscount = fristDiscount;
        this.secondRecommend = secondRecommend;
        this.secondContribution = secondContribution;
        this.secondDiscount = secondDiscount;
        this.productId = productId;
        this.plateformCash = plateformCash;

    }
}
